﻿<controls:OrganizationTypePanelBase x:Name="organizationTypePanelBase"
                                    x:Class="Rio.Framework.Pages.Controls.BindableOrganizationFolderTypePanel"
                                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                                    xmlns:controls="clr-namespace:Rio.Framework.Pages.Controls.BaseClass"
                                    xmlns:conv="clr-namespace:Rio.Framework.Pages.Helpers.Converter"
                                    xmlns:Converter="clr-namespace:Rio.Framework.Pages.AppCode.Helpers.Converter"
                                    mc:Ignorable="d"
                                    Loaded="organizationTypePanelBase_Loaded">

    <controls:OrganizationTypePanelBase.Resources>

        <Converter:NullToEnabledConverter x:Key="NullToEnabledConverter" />
        
        <Style x:Key="LabelControleDocumentStyle"
               TargetType="TextBlock">
            <Setter Property="Margin"
                    Value="5,10,15,0" />
            <Setter Property="HorizontalAlignment"
                    Value="Left" />
            <Setter Property="TextWrapping"
                    Value="Wrap" />
        </Style>

        <Style x:Key="TextBoxControleDocumentStyle"
               TargetType="TextBox">
            <Setter Property="Margin"
                    Value="5,0,15,0" />
            <Setter Property="HorizontalAlignment"
                    Value="Stretch" />
            <Setter Property="TextWrapping"
                    Value="Wrap" />
        </Style>

        <Style x:Key="ComboBoxStyle"
               TargetType="ComboBox">
            <Setter Property="Height"
                    Value="25" />
            <Setter Property="Margin"
                    Value="5,0,5,0" />
            <Setter Property="HorizontalAlignment"
                    Value="Stretch" />
        </Style>
        <Style x:Key="TextBlockStyle"
               TargetType="TextBlock">
            <Setter Property="Margin"
                    Value="5,5,5,0" />
            <Setter Property="HorizontalAlignment"
                    Value="Stretch" />
            <Setter Property="TextWrapping"
                    Value="Wrap" />
        </Style>
    </controls:OrganizationTypePanelBase.Resources>

    <Grid x:Name="LayoutRoot">

        <StackPanel HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch">
            <TextBlock x:Name="labelOrganization"
                       Style="{StaticResource TextBlockStyle}"
                       Margin="5"
                       Text="{Binding OrganizationLabel, ElementName=organizationTypePanelBase}" FontWeight="Bold" />
            <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch">
                <Image x:Name="imageEntity"
                       Width="32"
                       Height="32"
                       Margin="5,0,0,0"
                       Source="/Rio.Framework.Pages;component/Assets/Images/Entity.png" />
                <ComboBox Width="260"
                          Name="cbOrganization"
                          Style="{StaticResource ComboBoxStyle}"
                          ItemsSource="{Binding Organizations, ElementName=organizationTypePanelBase}"
                          SelectionChanged="OrganizationComboBox_SelectionChanged"
                          DisplayMemberPath="Name" />
            </StackPanel>

            <TextBlock x:Name="labelFolderType"
                       Style="{StaticResource TextBlockStyle}"
                       Text="{Binding FolderTypeLabel, ElementName=organizationTypePanelBase}" FontWeight="Bold" Margin="5" />
            <StackPanel Orientation="Horizontal"
                        Margin="0"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch">
                <Image x:Name="imageFolderType"
                       Width="32"
                       Height="32"
                       Margin="5,0,0,0"
                       Source="/Rio.Framework.Pages;component/Assets/Images/Folder.png" />
                <ComboBox Width="260"
                          Name="cbFolderType"
                          IsEnabled="{Binding SelectedOrganization, Converter={StaticResource NullToEnabledConverter}}"
                          Style="{StaticResource ComboBoxStyle}"
                          ItemsSource="{Binding FolderTypes, ElementName=organizationTypePanelBase}"
                          SelectionChanged="cbFolderType_SelectionChanged"
                          DisplayMemberPath="Label"  />
            </StackPanel>
        </StackPanel>
    </Grid>
</controls:OrganizationTypePanelBase>